package com.ruoyi.management.statistical.carservicemsg.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.management.basics.controller.BaseExtController;
import com.ruoyi.management.statistical.carservicemsg.service.ITCarServiceMsgService;
import com.ruoyi.management.statistical.carservicemsg.vo.CarEveListVo;
import com.ruoyi.management.statistical.carservicemsg.vo.CarServiceListVo;
import com.ruoyi.management.statistical.carservicemsg.vo.GetCarServiceMsgVo;
import com.ruoyi.management.statistical.carservicemsg.vo.GetPassengersNumberVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 车辆行驶信息Controller
 * 
 * @author ruoyi
 * @date 2021-12-01
 */
@RestController
@RequestMapping("/msg")
public class TCarServiceMsgController extends BaseExtController {
    @Autowired
    private ITCarServiceMsgService tCarServiceMsgService;

    /**
     * 统计公里利用率：载客里程/行驶总里程数（前日）
     *
     */
    @ApiOperation(value = " 统计公里利用率：载客里程/行驶总里程数（前日）", notes = "统计公里利用率：载客里程/行驶总里程数（前日）")
    @GetMapping(value = "/get_kilometer_utilization")
    public AjaxResult getKilometerUtilization() {
        Long companyId = getCompanyId();
        GetCarServiceMsgVo vo= tCarServiceMsgService.getKilometerUtilization(companyId);
        return AjaxResult.success(vo);
    }

    /**
     * 统计每车日均载客次数（总载客次数/营运车辆数）昨日
     *
     */
    @ApiOperation(value = " 统计每车日均载客次数（总载客次数/营运车辆数）昨日", notes = "统计每车日均载客次数（总载客次数/营运车辆数）昨日")
    @GetMapping(value = "/get_passengers_number")
    public AjaxResult getPassengersNumber() {
        Long companyId = getCompanyId();
        GetPassengersNumberVo vo= tCarServiceMsgService.getPassengersNumber(companyId);
        return AjaxResult.success(vo);
    }

    /**
     * 统计每车日均载客次数（总载客次数/营运车辆数）昨日
     *
     */
    @ApiOperation(value = " 统计每车日均营收（总收入/营运车辆数）昨日", notes = "统计每车日均营收（总收入/营运车辆数）昨日")
    @GetMapping(value = "/get_car_amount")
    public AjaxResult getCarAmount() {
        Long companyId = getCompanyId();
        GetPassengersNumberVo vo= tCarServiceMsgService.getCarAmount(companyId);
        return AjaxResult.success(vo);
    }

    /**
     * 统计每车日均每车日均总行驶里程（总行驶里程/营运车辆数）昨日
     *
     */
    @ApiOperation(value = " 统计每车日均每车日均总行驶里程（总行驶里程/营运车辆数）昨日", notes = "统计每车日均每车日均总行驶里程（总行驶里程/营运车辆数）昨日")
    @GetMapping(value = "/get_car_mileags")
    public AjaxResult getCarMileags() {
        Long companyId = getCompanyId();
        GetPassengersNumberVo vo= tCarServiceMsgService.getCarMileags(companyId);
        return AjaxResult.success(vo);
    }

    /**
     * 统计每车日均每车日均运营里程（总运营里程/营运车辆数）昨日
     *
     */
    @ApiOperation(value = " 统计每车日均每车日均运营里程（总运营里程/营运车辆数）昨日", notes = "统计每车日均每车日均运营里程（总运营里程/营运车辆数）昨日")
    @GetMapping(value = "/get_car_yymileags")
    public AjaxResult getCarYyMileags() {
        Long companyId = getCompanyId();
        GetPassengersNumberVo vo= tCarServiceMsgService.getCarYyMileags(companyId);
        return AjaxResult.success(vo);
    }

    /**
     * 巡游车营收排行 带分页
     */
    @ApiOperation(value = " 巡游车营收排行 带分页", notes = "巡游车营收排行 带分页")
    @GetMapping("/get_carservice_list")
    public TableDataInfo list() {
        Long companyId = getCompanyId();
        startPage();
        List<CarServiceListVo> list = tCarServiceMsgService.selectCarServiceMsgList(companyId);
        return getDataTable(list);
    }

    /**
     * 巡游车服务评价排行 带分页
     */
    @ApiOperation(value = " 巡游车服务评价排行 带分页", notes = "巡游车服务评价排行 带分页")
    @GetMapping("/get_careve_list")
    public TableDataInfo getCarEveList() {
        Long companyId = getCompanyId();
        startPage();
        List<CarEveListVo> list = tCarServiceMsgService.getCarEveList(companyId);
        return getDataTable(list);
    }
}
